package com.xf.common;

import java.io.Serializable;

public class Invocation implements Serializable {
    private String interfaceName;
    private String methodName;
    private Class[] parameterTypes;
    private Object[] parameters;
    private String version;

    public Invocation(String interfaceName, String methodName, Class[] parameterTypes, Object[] parameters,String version) {
        this.interfaceName = interfaceName;
        this.methodName = methodName;
        this.parameterTypes = parameterTypes;
        this.parameters = parameters;
        this.version=version;
    }


    public String getInterfaceName() {
        return interfaceName;
    }

    public String getMethodName() {
        return methodName;
    }

    public Class[] getParameterTypes() {
        return parameterTypes;
    }

    public Object[] getParameters() {
        return parameters;
    }

    public String getVersion() {
        return version;
    }

    public String getMethod() {
        String s=this.methodName;
        if(this.parameterTypes.length==0){
            s+="()";
        }
        else{
            s+="(";
            s+=parameterTypes[0].getSimpleName();
            for (int i = 1; i < parameterTypes.length; i++) {
                s+=","+parameterTypes[i].getSimpleName();
            }
            s+=")";
        }
        return s;
    }
}
